/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sv.gob.dgii.controlador;

import javax.persistence.EntityManager;
import javax.persistence.Persistence;

/**
 *
 * @author luisrg
 */
public class Conexion {
    private static final String NOMBRE_PERSISTENCE_UNIT = "DGIIDemoDinamicaRUCPU";
    private static EntityManager manejadorEntidades = null;
    
    public static EntityManager obtenerManejadorEntidades(){
        if(manejadorEntidades==null || !manejadorEntidades.isOpen())
            return Persistence.createEntityManagerFactory(NOMBRE_PERSISTENCE_UNIT).createEntityManager();
        return manejadorEntidades;
    }
    
}
